<?php

class M_reports Extends MY_Controller
{

	public function total_enrolled_students_with_student_id()
	{
		$sql = "SELECT e.e_profile_id,
					   e.e_student_id,
					   e.e_grade_level,
					   l.level_desc
				FROM enrollments e
				LEFT JOIN profiles p ON p.profile_id = e.e_profile_id
				LEFT JOIN levels l ON l.level_id = e.e_grade_level
				WHERE e.e_grade_level IN (SELECT level_id FROM levels)
				AND e.verified = 1
			   ";
		$query = $this->db->query($sql);
		

		
		if($query->num_rows() >= 1)
		{
			$data = $query->result();
			

			foreach($data as $k => $v)
			{
				$level[] = $v->e_grade_level;
				if(prev($level) !==$v->e_grade_level)
				{
					$result_data[$v->e_grade_level][$k]['profile_id'] = $v->e_profile_id;
					$result_data[$v->e_grade_level][$k]['student_id'] = $v->e_student_id;
				}else{
					$result_data[$v->e_grade_level][$k]['profile_id'] = $v->e_profile_id;
					$result_data[$v->e_grade_level][$k]['student_id'] = $v->e_student_id;
				}
			}
			
			return $result_data;
		}else{
			// no row was retrieved
			return FALSE;
		}
	}
	
	
	public function count_enrolled_students_per_grade_level()
	{
		$sql_get_grade_level = '';
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	}














}